﻿#ifndef _CSPAREPART_H_
#define _CSPAREPART_H_

#ifdef __cplusplus
extern "C" {
#endif

#define SPARE_PART_ATOM_COUNT_MAX   8

#define ATOM_SHAPE_NORMAL			1
#define ATOM_SHAPE_DIAMOND			2

typedef struct _tos_point_ {
    short x;
    short y;
} TOS_POINT;

typedef struct _tos_size_ {
    short width;
    short length;
} TOS_SIZE;

typedef struct _tos_atom_ {
    TOS_POINT   coord; //coordinate base on own origin
    char        data;
} TOS_ATOM;

typedef struct _cspare_part_ {
    TOS_POINT	origin; //original point in chessboard
    char		atom_cnt;
    TOS_ATOM	atoms[SPARE_PART_ATOM_COUNT_MAX]; // real count depends on atoms_count    
} CSparePart;

int set_atom_data_shape(char* a, int shape);

CSparePart* spare_part_clone_of(const CSparePart* from);
int spare_part_move_left(CSparePart* spare);
int spare_part_move_right(CSparePart* spare);
int spare_part_move_down(CSparePart* spare);
int spare_part_rotate(CSparePart* spare);

#ifdef __cplusplus
}
#endif
#endif
